#include<iostream>


class Base
{
    public:
        Base():a(0),b(1){};
        virtual ~Base(){};
        virtual int getA(){std::cout<<"a = "<<a<<"\n";return a;};
        virtual int getA(int x){std::cout<<"x = "<<x<<"\n";return a;};
        virtual int getB(){std::cout<<"b = "<<b<<"\n";return b;};
    private:
        int a;
        int b;
};


class Derived : public Base
{
    public:
        Derived(){};
        ~Derived(){};
        //virtual int getA() {return 0;};//如果有同名实现，将会遮掩基类实现

        //处理方案1
        using Base::getA;//inline方式实现调用

        //处理方案2:只使用一种
        virtual int getA() {Base::getA();};
};

int main(int argc, char const *argv[])
{
    Derived d;
    d.getA();//1处理之后，这里优先调用派生类的  2处理之后，这里优先调用基类的
    d.getA(1);//上面如果有实现，这里将报错
    return 0;
}
